#include "FileHandler.h"

FileHandler::FileHandler(const QString &fileName) :
    _fileName(fileName) {
}

void FileHandler::setName(const QString &fileName) {
    _fileName = fileName;
}

QString FileHandler::read() {
   QFile file(_fileName);
   QString tekst ="";
   if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
       throw FileNotFoundException();
   else{
       while (!file.atEnd()) {
          tekst+= file.readLine();
       }
   }
   return tekst;
}

void FileHandler::save(const QString &data) {
    throw FileNotFoundException();
}

FileHandler::~FileHandler() {

}
